
<!DOCTYPE html>
<html>
<head>
    <title>权限系统</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <link rel="stylesheet" href="/static/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="/static/dist/css/font-awesome.min.css">
    <link rel="stylesheet" href="/static/dist/css/ionicons.min.css">
    <link rel="stylesheet" href="/static/dist/css/AdminLTE.min.css">
    <link rel="stylesheet" href="/static/plugins/layui/2.5.6/css/layui.css">
    <script src="/static/plugins/jQuery/jquery-2.2.3.min.js"></script>
    <script src="/static/bootstrap/js/bootstrap.min.js"></script>
    <script src="/static/plugins/layui/2.5.6/layui.all.js"></script>
</head>
<body class="hold-transition login-page">
<div class="login-box">
    <div class="login-logo">
        <b>权限系统</b>
    </div>
    <!-- /.login-logo -->
    <div class="login-box-body">
        <p class="login-box-msg">管理员登陆</p>

        <form action="" method="post" onsubmit="return doLogin();">
            <div class="form-group has-feedback">
                <input name="username" class="form-control" placeholder="账户">
                <span class="glyphicon glyphicon-user form-control-feedback"></span>
            </div>
            <div class="form-group has-feedback">
                <input type="password" name="username" class="form-control" placeholder="密码">
                <span class="glyphicon glyphicon-lock form-control-feedback"></span>
            </div>
            <div class="row">

                <!-- /.col -->
                <div class="col-xs-4">
                    <button type="submit" class="btn btn-primary btn-block btn-flat">登录</button>
                </div>
                <!-- /.col -->
            </div>
        </form>


    </div>
    <!-- /.login-box-body -->
</div>

<script>
function doLogin() {
    var param = {
        username:$("[name='username']").val(),
        password:$("[name='password']").val(),
    }
    $.post("/admin/auth/login", param, function(res) {
        if (res.success) {
            window.localStorage.setItem("cloud_token",res.data);
            location.href = "index.html";
        } else {
            layer.msg(res.message, {icon:2})
        }
    },"json");
    return false;
}
</script>
</body>
</html>
